const UserModel =require("../model/UserModel")
const UserService={
            addUser:()=>{
              return  UserModel.create({
                    username,password,age
                 })
            },
            updateUser:(_id,body)=>{
             return  UserModel.updateOne({_id},body)
    
            },
            deleteUser:(_id)=>{
              return  UserModel.deleteOne({_id})
            },
            getUser:(page,limit)=>{
             return  UserModel.find({},["username","age"]).sort({age:-1}).skip((page-1)*limit)
            }
}

module.exports=UserService